<template>
	<view class="pageBox" :style="{paddingTop: statusBarHeight + 44 + 'px',}">
		<view class="topHead flex-between" :style="{top: statusBarHeight + 'px',}">
			<uni-icons type="back" size="24" @click="goBack"></uni-icons>
			<view class="title">
				服务中心
			</view>
			<view class="right" @click="onRight">
				服务中心说明
			</view>
		</view>
		<view class="top flex-between">
			<view class="topL">
				本月新增VIP数量：{{ vipNum }}个
			</view>
			<view class="topR">
				本月新增业绩：{{ achievement }}
			</view>
		</view>
		
		
		<view class="list">
			<view class="listItem flex-between">
				<view class="item flex-center">
					新增VIP
				</view>
				<view class="item flex-center">
					新增业绩
				</view>
				<view class="item flex-center">
					交易额
				</view>
			</view>
			
			<view class="listItem flex-between" v-for="item in list" :key="item.id">
				<view class="item flex-center">
					{{ item.account }}
				</view>
				<view class="item flex-center">
					{{ item.achievement }}
				</view>
				<view class="item flex-center">
					{{ item.performance }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				statusBarHeight: "",
        achievement: "",
        vipNum: "",
				list: [],
			}
		},
    onLoad() {
			this.statusBarHeight = this.$mySysInfo().top;
      this.getList();
    },
		methods: {
			onRight() {
				uni.navigateTo({
					url: '/serviceCenter/serviceNote?from=服务中心&type=1'
				})
			},
			getList() {
        this.$post({
          module: "User",
          interface: "3005",
          data: {
            type: "1"
          },
        }).then(res => {
          // console.log("服务中心数据统计记录", res);
          this.list = res.vipList;
          this.vipNum = res.vipNum;
          this.achievement = res.achievement;
        })
      },
			goBack() {
				const pages = getCurrentPages()
				if (pages.length === 1) {
					if (typeof params === 'number') {
						history.go(-params)
					} else {
						history.back()
					}
				} else {
					uni.navigateBack({
						delta: 1
					});
				}
			},
		},
	}
</script>

<style scoped lang="scss">
	.pageBox {
		padding: 0 32rpx;
		.topHead {
			background-color: #ffffff;
			height: 88rpx;
			width: 100%;
			padding: 0 32rpx;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 3;
		
			.title {
				font-size: 32rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #000000;
				position: absolute;
				top: 22rpx;
				left: 50%;
				transform: translate(-50%, 0);
			}
		
			.right {
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #F2615F;
			}
		}
		.top {
			width: 100%;
			padding: 32rpx;
			background-color: #f9f9f9;
			.topL {
				flex: 1;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
				line-height: 40rpx;
				text-align: left;
			}
			.topR {
				flex: 1;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
				line-height: 40rpx;
				text-align: right;
			}
		}
		.list {
			margin-top: 40rpx;
			.listItem {
				margin-bottom: 32rpx;
				.item {
					flex: 1;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #000000;
					line-height: 40rpx;
					word-break: break-all;
				}
			}
		}
	}
</style>